********************************************
**** GLES Short-term Campaign Panel 2009
********************************************

use "SET_YOUR_PATH_FOR_INPUT\ZA5305_v5-0-0.dta", clear


**************************
*** Recode Variables
**************************



**************************
*** Socio-economic problems
**************************

*personal financial situation
mvdecode  kp2_780 kp4_780 kp6_780 kp7_780, mv(99)

rev kp2_780, gen(ewl_2009_2)
rev kp4_780, gen(ewl_2009_4)
rev kp6_780, gen(ewl_2009_6)
rev kp7_780, gen(ewl_2009_7)

fre ewl_2009_2-ewl_2009_7

pwcorr  ewl_2009_2-ewl_2009_7

*net household income
mvdecode kp2_2590, mv(99)
clonevar income_2009 = kp2_2590



**************************
*** Political Knowledge
**************************
/* Variables 
kp1_110   ///
kp2_090 kp2_120 kp2_130    ///
kp3_100 kp3_130 kp3_140  ///
kp4_90 kp4_110  ///
kp6_090 kp6_110 kp6_130 kp6_140 kp6_141   ///
kp7_090 kp7_110 kp7_141 */


*Political Knowledge: 5% clause
foreach var of varlist kp2_090 kp4_090 kp6_090 kp7_090 {
	recode `var' (5=1 "richtig")(else=0 "falsch"), gen(`var'_r)
	}
clonevar wissen1_2009_2 = kp2_090_r
clonevar wissen1_2009_4 = kp4_090_r
clonevar wissen1_2009_6 = kp6_090_r
clonevar wissen1_2009_7 = kp7_090_r

*Political Knowledge: first and second vote
foreach var of varlist kp1_110 kp4_110 kp6_110 kp7_110 {
	recode `var' (2=1 "richtig")(else=0 "falsch"), gen(`var'_r)
	}
clonevar wissen2_2009_1 = kp1_110_r
clonevar wissen2_2009_4 = kp4_110_r
clonevar wissen2_2009_6 = kp6_110_r
clonevar wissen2_2009_7 = kp7_110_r

*Political Knowledge: voting law in Germany
foreach var of varlist kp3_130 kp6_130  {
	recode `var' (3=1 "richtig")(else=0 "falsch"), gen(`var'_r)
	}
clonevar wissen3_2009_3 = kp3_130_r
clonevar wissen3_2009_6 = kp6_130_r

*Political Knowledge: secrecy of the ballot
foreach var of varlist kp3_100 {
	recode `var' (4=1 "richtig")(else=0 "falsch"), gen(`var'_r)
	}
clonevar wissen00_2009_3 = kp3_100_r

*Political Knowledge: number of federal states
foreach var of varlist kp2_120 {
	recode `var' (16=1 "richtig")(else=0 "falsch"), gen(`var'_r)
	}
clonevar wissen01_2009_2 = kp2_120_r

*Political Knowledge: Bundesrat
foreach var of varlist kp3_140 kp6_140 {
	recode `var' (2=1 "richtig")(else=0 "falsch"), gen(`var'_r)
	}
clonevar wissen02_2009_3 = kp3_140_r
clonevar wissen02_2009_6 = kp6_140_r



	
	
	
	
****************************
*** Knowledge indices ******
****************************

* Verbal knowledge: Wave 6
gen wissen_verb_2009_6 = wissen1_2009_6 + wissen2_2009_6 + wissen3_2009_6

lab var wissen_verb_2009_6 "Index: Political Knowledge, verbally 2009 (Wave 6)"




**************************
*** other indicators
**************************

* intention to vote
fre kp?_170

foreach num of numlist 1/7 {
	capture recode kp`num'_170 (1 6=5 "certain to vote")(2=4)(3=3)(4=2) ///
			(5=1 "certain not to vote") (else=.), gen(itv_2009_`num')
	capture lab var itv_2009_`num' "Intention to Vote 2009 (Wave `num')"		
}


* use internet for political issues
foreach num of numlist 1/7 {
	capture mvdecode kp`num'_1600, mv(99/101)
	capture gen inet_pol_2009_`num' =  kp`num'_1600 - 1
	capture lab var inet_pol_2009_`num' "Internet use in days per week, politically current 2009 (Wave `num')"		
}

* use print media for political issues
foreach num of numlist 1/7 {
	capture mvdecode kp`num'_1660?, mv(99/101)
	capture gen print_pol_bild_2009_`num' =  kp`num'_1660a - 1
	capture gen print_pol_fr_2009_`num' =  kp`num'_1660b - 1
	capture gen print_pol_faz_2009_`num' =  kp`num'_1660c - 1
	capture gen print_pol_sz_2009_`num' =  kp`num'_1660d - 1
	capture gen print_pol_taz_2009_`num' =  kp`num'_1660e - 1
	capture gen print_pol_welt_2009_`num' =  kp`num'_1660f - 1
	capture gen print_pol_other_2009_`num' =  kp`num'_1660g - 1
	capture gen print_pol_online_2009_`num' =  kp`num'_1660h - 1
	
	capture lab var print_pol_bild_2009_`num' "Print media use (BILD), politically current 2009 (Wave `num')"		
	capture lab var print_pol_fr_2009_`num' "Print media use (Frank. Rund.), politically current 2009 (Wave `num')"		
	capture lab var print_pol_faz_2009_`num' "Print media use (FAZ), politically current 2009 (Wave `num')"		
	capture lab var print_pol_sz_2009_`num' "Print media use (SZ), politically current 2009 (Wave `num')"		
	capture lab var print_pol_taz_2009_`num' "Print media use (TAZ), politically current 2009 (Wave `num')"		
	capture lab var print_pol_welt_2009_`num' "Print media use (Welt), politically current 2009 (Wave `num')"		
	capture lab var print_pol_other_2009_`num' "Print media use (other), politically current 2009 (Wave `num')"		
	capture lab var print_pol_online_2009_`num' "Print media use (online), politically current 2009 (Wave `num')"		
}


* use tv for political issues
foreach num of numlist 1/7 {
	capture mvdecode kp`num'_1680?, mv(98/101)
	capture gen tv_pol_ard_2009_`num' =  kp`num'_1680a - 1
	capture gen tv_pol_zdf_2009_`num' =  kp`num'_1680b - 1
	capture gen tv_pol_rtl_2009_`num' =  kp`num'_1680c - 1
	capture gen tv_pol_sat1_2009_`num' =  kp`num'_1680d - 1
	capture gen tv_pol_pro7_2009_`num' =  kp`num'_1680e - 1
	
	capture lab var tv_pol_ard_2009_`num' "TV media use (ARD), politically current 2009 (Wave `num')"		
	capture lab var tv_pol_zdf_2009_`num' "TV media use (ZDF), politically current 2009 (Wave `num')"		
	capture lab var tv_pol_rtl_2009_`num' "TV media use (RTL), politically current 2009 (Wave `num')"		
	capture lab var tv_pol_sat1_2009_`num' "TV media use (Sat 1), politically current 2009 (Wave `num')"		
	capture lab var tv_pol_pro7_2009_`num' "TV media use (Pro7), politically current 2009 (Wave `num')"		
}



* talk about politics
foreach num of numlist 1/9 {
	capture mvdecode kp`num'_1930, mv(99/101)
	capture clonevar talk_pol_2009_`num' =  kp`num'_1930
	capture lab var talk_pol_2009_`num' "Conversations about politics in general in days per week 2009 (Wave `num')"		
}



* importance of election outcome
foreach num of numlist 1/7 {
	capture mvdecode kp`num'_380, mv(99/101)
	capture clonevar imp_elec_2009_`num' = kp`num'_380 
	capture lab var imp_elec_2009_`num' "Interest in the outcome of the election 2009 (Wave `num')"		
}


* Interest, election campaign
foreach num of numlist 1/7 {
	capture mvdecode kp`num'_380, mv(99/101)
	capture clonevar imp_elec_camp_2009_`num' = kp`num'_380 
	capture lab var imp_elec_camp_2009_`num' "Interest, election campaign 2009 (Wave `num')"		
}


* Political Interest
foreach num of numlist 1/9 {
	capture mvdecode kp`num'_010, mv(99/101)
	capture recode kp`num'_010 (1=5 "very strong")(2=4)(3=3)(4=2)(5=1 "not at all")(else=.), gen(polint_2009_`num')	
	capture lab var polint_2009_`num' "Political Interest 2009 (Wave `num')"		
}


* Political Efficacy
foreach num of numlist 1/7 {
	capture mvdecode kp`num'_050a kp`num'_050e kp`num'_050h kp`num'_050k, mv(99/101)
	capture clonevar effint1_2009_`num' =  kp`num'_050h
	capture clonevar effint2_2009_`num' =  kp`num'_050k
	capture clonevar effex1_2009_`num' =  kp`num'_050a
	capture clonevar effex2_2009_`num' =  kp`num'_050e

	capture lab var effint1_2009_`num' "Efficacy, internal: I have the confidence to take active part in group that discusses pol. issues 2009 (Wave `num')"		
	capture lab var effint2_2009_`num' "Efficacy, internal: I am perfectly able to understand and assess important pol. questions 2009 (Wave `num')"		
	capture lab var effex1_2009_`num' "Efficacy, external: Politicians care about what ordinary people think 2009 (Wave `num')"	
	capture lab var effex2_2009_`num' "Efficacy, external: Politicians try to get in close contact with the population 2009 (Wave `num')"		
}

* Party ID & Strength
foreach num of numlist 1 3 5 7  {
	capture recode kp`num'_2090 (1/801=1 "has PID")(808 999=0 "has no PID")(else=.), gen(partyid_2009_`num')
	capture gen pidstr_2009_`num' = .
	capture replace pidstr_2009_`num' = 0 if partyid_2009_`num'==0 | kp`num'_2100==99 | kp`num'_2100==100
	capture replace pidstr_2009_`num' = 1 if kp`num'_2100==5
	capture replace pidstr_2009_`num' = 2 if kp`num'_2100==4
	capture replace pidstr_2009_`num' = 3 if kp`num'_2100==3
	capture replace pidstr_2009_`num' = 4 if kp`num'_2100==2
	capture replace pidstr_2009_`num' = 5 if kp`num'_2100==1

	capture lab var partyid_2009_`num' "Has Party ID 2009 (Wave `num')"		
	capture lab var pidstr_2009_`num' "Party ID Strength 2009 (Wave `num')"		
}


*Voted: yes/no
recode kp7_180 (1=1 "yes")(2 99=0 "no")(else=.), gen(vote_2009)
lab var vote_2009 "Voted in 2009"


*****************************************
*** Socio-Demographics
*****************************************

* East/West
recode fedstate (12/16=1 "East") (1/11=0 "West")(else=.), gen(east_2009)
clonevar east = east_2009

*Education
recode kpx_2320 (1 2=1 "low")(3=2 "medium")(4 5=3 "high")(6=.a "still student"), gen (edu_2009)
lab var edu_2009 "Education (3-cat)"
clonevar edu = edu_2009

*Age
gen age_2009=(2009-kpx_2290)
lab var age_2009 "Age"
clonevar age = age_2009

*Gender
recode kpx_2280 (1=0 "male")(2=1 "female"), gen(sex_2009)
lab var sex_2009 "Gender"
clonevar sex = sex_2009

*Unemployed
recode kpx_2340 (5=1 "unemployed")(99/101=.)(else=0 "not unemployed"), gen(unemployed_2009)
lab var unemployed_2009 "Unemployed"

*Not in labor force
recode kpx_2340 (3 7/10 12/14=1 "nlf")(99/101=.)(else=0 "in labor force"), gen(nlf_2009)
lab var nlf_2009 "Not in labor force"

*Employment status
fre kpx_2340
mvdecode kpx_2340, mv(99/101)
clonevar empstat_2009 = kpx_2340
lab var empstat_2009 "Employment Status"

*Occupation
fre kpx_2380
mvdecode kpx_2380, mv(99 101)
clonevar occupation_2009 = kpx_2380
lab var occupation_2009 "Occupation"

*HH size
recode kpx_2440 (99 100=.), gen(hhsize_2009)


*Migration status
fre kp2_2540
recode kp2_2540 (2/4=0 "no migrant")(4/99=1 "migrant")(else=.), gen(migrant_2009)

clonevar test_2009 = kp2_2540

*****************************************
*** Save data
*****************************************
clonevar lfdn_2009 = lfdn
gen year_2009 = 2009

keep year year_2009 lfdn_2009 ewl_2009_2-occupation_2009 hhsize_2009 gew_q1_w1-gew_p4_ges migrant_2009 test_2009
drop kp* 

save "SET_YOUR_PATH_FOR_OUTPUT\GLES\wkp2009_short.dta", replace










